<?php

/**
 * @param username
 */
require_once('rb.php');
$random = rand(0, 1);
//if ($random == 0) {
    R::setup('mysql:host=ftp.giemiebier.nl:3306;dbname=personify', 'school', 'admin123');
//} else {
  //  R::setup('mysql:host=server.markvdlaan.nl:3306;dbname=personify', 'school', 'admin');
//}

if ($pagetree[2] != "" && isset($pagetree[2])) {
    $email = $pagetree[2];
} else {
    $email = "";
}
$users = R::getAll('select * from users where emailaddress LIKE :email', array(':email' => "%" . $email . "%")
);

foreach ($users as $user) {
    $return['emails'][] = $user["emailaddress"];
    $return['ids'][] = $user["id"];
}

echo json_encode($return);
?>
